

import boot.Boot;
import function.ChainMp3;
import function.ChainMp3Impl;
import function.Mp3File;

public class ArtistsChoiceHandler {

	Mp3File[] choices = null;
	
	public ArtistsChoiceHandler(ChainMp3Impl chainChoices) {
		choices = new Mp3File[chainChoices.getLength()];
		ChainMp3 current = chainChoices;
		
		for (int i = 0; i < choices.length; i++) {
			choices[i] = current.getMp3File();
			current = current.getNext();
		}
	}

	public void processKey(int keyCode) {
		int offset = 49;
		
		if ((keyCode < 49) || (keyCode > 49 + choices.length - 1)) {
			return;
		}
		
		Mp3File mp3 = choices[keyCode - offset];
		Boot.getInstance().enqueueMp3(mp3);
		Boot.getInstance().readyToGo();
		// TODO TEST artist tune choice
	}
}
